Skip to content

[backend] Fix broken migrations (#16101)#16102

Open
fellowseb wants to merge 1 commit into
masterfrom
issue/16101-legacy-tokens-migration-broken
Open

[backend] Fix broken migrations (#16101)#16102
fellowseb wants to merge 1 commit into
masterfrom
issue/16101-legacy-tokens-migration-broken

Conversation

@fellowseb
Copy link
Copy Markdown
Member

@fellowseb fellowseb commented May 21, 2026

Proposed changes

Fixes broken migrations after regression in introduced in #14867.

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case (coverage and e2e)
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

@fellowseb fellowseb self-assigned this May 21, 2026
@github-actions github-actions Bot added the filigran team use to identify PR from the Filigran team label May 21, 2026
@fellowseb fellowseb marked this pull request as ready for review May 21, 2026 00:02
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.40%. Comparing base (0adbde1) to head (ae92065).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #16102       +/-   ##
===========================================
+ Coverage   35.71%   44.40%    +8.69%     
===========================================
  Files        3232      898     -2334     
  Lines      221682    95194   -126488     
  Branches    41430     3992    -37438     
===========================================
- Hits        79169    42273    -36896     
+ Misses     142513    52921    -89592     
Flag Coverage Δ
opencti-client-python ?
opencti-front ?
opencti-graphql 44.40% <ø> (-28.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes several backend migration scripts that became broken after an engine API regression, by updating Elasticsearch engine helper calls to pass the migration execution context explicitly.

Changes:

  • Update migration calls to elUpdate, elBulk, and elReplace to include context as the first argument.
  • Adjust helper function signatures in the credentials encryption migration to accept/pass context.
  • Ensure the legacy token migration uses the updated elUpdate(context, ...) signature.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
opencti-platform/opencti-graphql/src/migrations/1777898748017-encrypt-credentials-at-rest.js Passes migration context through helper functions and into elUpdate for credential field encryption.
opencti-platform/opencti-graphql/src/migrations/1776859399668-software_case_insensitive_standard_id.js Updates bulk rewrite to call elBulk(context, ...) during Software standard_id migration.
opencti-platform/opencti-graphql/src/migrations/1776689803463-decay-rule-observable-types-to-filters.js Updates bulk write step to call elBulk(context, ...).
opencti-platform/opencti-graphql/src/migrations/1776164753048-note_standard_id_abstract.js Updates bulk write step to call elBulk(context, ...).
opencti-platform/opencti-graphql/src/migrations/1775570561286-update_capabilities_description.js Updates capability patching to call elReplace(context, ...).
opencti-platform/opencti-graphql/src/migrations/1769815233918-legacy_token_migration.js Fixes legacy token migration updates by calling elUpdate(context, ...).
opencti-platform/opencti-graphql/src/migrations/1742823297617-remove_multiple_authors.js Fixes author cleanup migration by calling elUpdate(context, ...).
opencti-platform/opencti-graphql/src/migrations/1678399004322-rel-merge-adapt.js Fixes denormalized cleanup migration by calling elUpdate(context, ...).
opencti-platform/opencti-graphql/src/migrations/1661196127751-artifacts.js Fixes artifacts file migration by calling elUpdate(context, ...).
opencti-platform/opencti-graphql/src/migrations/1652125339035-files_database.js Fixes files database migration by calling elUpdate(context, ...).

@fellowseb fellowseb force-pushed the issue/16101-legacy-tokens-migration-broken branch from ae92065 to b952dee Compare May 21, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team use to identify PR from the Filigran team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legacy tokens migration broken

2 participants